NAME
mapping - an associative array

SYNTAX EXAMPLE
([ index1:data1, index2:data2 ])

DESCRIPTION
A mapping is basically an array that can be indexed on any type, not not just integers. It can also be seen as a way of linking data (usaully strings) together. It consists of a lot of index-data pairs which are linked togeter in such a way that map[index1] returns data1. It is also possible to set that data by writing map[index1]=new_data1. If you try to set an index in a mapping that isn't already present in the mapping then it will be added.

Here follows a list of operators that applies to mappings: In this list a and b is used to represent a mapping expression:

a + b summation ( ([1:1]) + ([2:2,2:2]) returns ([1:1,2:2,2:2]) )
a - b subtraction, returns a copy of a with all pairs whos index is present in b removed.
a & b intersection, return a mapping with all indices that are resent in both a and b, if an index is present in both a & b the data for that index will be taken from b.
a | b union, return a mapping with all values that are present in a or b, differs from summation in that values that are present in both a and b are only returned once, as with intersection, data will be taken from b when possible.
a ^ b xor, return a mapping with all indices that are present in a or b but not in both.
a == b returns 1 if a is the same mapping as b, same size, indices and values is not enough, 0 otherwise.
a != b returns 0 if a is the same mapping as b, same size, indices and values is not enough, 1 otherwise.
! a boolean not, returns 0
a[c] indexing, returns the value associated with the value c in the mapping a. If there is no index c in the mapping zero will be returned. (With zero_type = 1)
a[c]=d setting, this associates d with c in the mapping, the index c will be added to the mapping automatically if it isn't already there.

KEYWORDS
types

SEE ALSO
array, multiset, sizeof, indices, values and zero_type

RELATED PAGES